public class Reservation
{
    private Traveler traveler; // name of traveler
    private RoomType roomType; // type of room
    private Traveler partner; // traveler's partner, if they have one
    
    /**
     * Initialize reservation
     * 
     * @param travelerName
     *            name of traveler
     * @param partner
     *            traveler's partner
     */
    public Reservation(Traveler traveler, Traveler partner)
    {
        setTraveler(traveler);
        setRoomType(RoomType.PARTNER); // We either have a partner or not, so we auto set the roomType if we have a partner
        setPartner(partner);
    }
    
    /**
     * Initialize reservation
     * 
     * @param travelerName
     *            name of traveler
     * @param wantsRoommate
     *            for type of room
     */
    public Reservation(Traveler traveler, boolean wantsRoommate)
    {
        setTraveler(traveler);
        if (wantsRoommate)
            setRoomType(RoomType.SOLO);
        else
            setRoomType(RoomType.SINGLE);
    }
    
    /**
     * @return name of traveler
     */
    public Traveler getTraveler()
    {
        return traveler;
    }
    
    public String getTravelerName()
    {
        return traveler.GetName();
    }
    
    /**
     * @return type of room
     */
    public RoomType getRoomType()
    {
        return roomType;
    }
    
    /**
     * @return traveler's partner, if they have one
     */
    // protected Reservation getPartner()
    public Traveler getPartner()
    {
        return partner;
    }
    
    public String getPartnerName()
    {
        return partner.GetName();
    }
    
    /**
     * Set traveler
     * 
     * @param traveler
     *            name of traveler
     */
    private void setTraveler(Traveler traveler)
    {
        this.traveler = traveler;
    }
    
    /**
     * Set room type
     * 
     * @param type
     *            type of room
     */
    private void setRoomType(RoomType type)
    {
        roomType = type;
    }
    
    /**
     * Set partner
     * 
     * @param partner
     *            traveler's partner
     */
    protected void setPartner(Traveler partner)
    {
        this.partner = partner;
    }
    
    public String toString()
    {
        String s = "\n";
        s += "Traveler Name: " + getTraveler().GetName() +
                "\tRoom Type: " + getRoomType();
        if (getPartner() != null)
            s += "\tPartner Name: " + getPartner().GetName();
        return s;
    }
    /**
     * Set new reservation partner if we can
     * 
     * @param newPartner
     *            new partner of this reservation
     * @return if we were able to change the partner
     */
    // public boolean changePartner(Reservation newPartner)
    // {
    // // traveler does not want a partner or reserved with one
    // // and shouldn't be changed
    // if (roomType == RoomType.SOLO || roomType == RoomType.PARTNER)
    // return false;
    //
    // // set current partner's partner to null if reservation had one
    // if (getPartner() != null)
    // getPartner().setPartner(null);
    //
    // // set new partner
    // setPartner(newPartner);
    // return true;
    // }
}